export function debounce(fn, delay) {
  let timer = null
  const debounce = function () {
    let that = this
    timer && clearTimeout(timer)
    timer = setTimeout(() => {
      fn.call(that)
    }, delay)
  }
  return debounce
}